package actions.complaints;

import java.util.List;

import data.Complaint;

import actions.base.BaseAction;

public class Listing extends BaseAction {
	
	List<Complaint> complaints;
	
	@Override
	public String execute() throws Exception {
		complaints = services.getComplaints();
		for (int i = 0; i < complaints.size(); i++) {
			Complaint complaint = complaints.get(i);
			String description = complaint.getComplaintDescription().substring(0, 100) + " ...";
			complaint.setComplaintDescription(description);
		}
		return SUCCESS;
	}

	/**
	 * @return the complaints
	 */
	public List<Complaint> getComplaints() {
		return complaints;
	}

	/**
	 * @param complaints the complaints to set
	 */
	public void setComplaints(List<Complaint> complaints) {
		this.complaints = complaints;
	}

}
